import sqlite3

def printCookies(cookiesDB):
    try:
        conn = sqlite3.connect(cookiesDB)
        c = conn.cursor()
        c.execute('SELECT host, name, value FROM moz_cookies')
        print('.\n[*] -- Found Cookies --')
        for row in c:
            host = str(row[0])
            name = str(row[1])
            value = str(row[2])
            print('[+] Host:' + host + ', Cookie: ' + name + ', Value: ' +value)
    except Exception as e:
        if 'encrypted' in str(e):
            print('\n[*] Error reading your cookies database.')
            print('[*] Upgrade your Python-Sqlite3 Library')

# printCookies(r'C:\Users\87761\Desktop\python\202278040316吕亚宁\cookies.sqlite')
def printHistory(placesDB):
    try:
        conn = sqlite3.connect(placesDB)
        c= conn.cursor()
        c.execute("select url, datetime(visit_date/1000000,'unixepoch')""from moz_places, moz_historyvisits where visit_count > 0 and moz_places.id==moz_historyvisits.place_id;")

        print('\n[*]-- Found History --')
        for row in c:
            url = str(row[0])
            date = str(row[1])
            print('[+]'+ date +'-visited:'+ url)
    except Exception as e:
        print(e)
        if 'encrypted' in str(e):
            print('\n[*]Error reading your places database.')
            print('[*]Upgrade your Python-sqlite3 Library')

printHistory(r"C:\Users\87761\Desktop\python\202278040316吕亚宁\places.sqlite")